﻿#region Header
// Copyright 2007-2011, Jerónimo Milea
// 
// This file is part of NetJsWire.
// 
//     NetJsWire is free software: you can redistribute it and/or modify
//     it under the terms of the GNU General Public License as published by
//     the Free Software Foundation, either version 3 of the License, or
//     (at your option) any later version.
// 
//     NetJsWire is distributed in the hope that it will be useful,
//     but WITHOUT ANY WARRANTY; without even the implied warranty of
//     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//     GNU General Public License for more details.
// 
//     You should have received a copy of the GNU General Public License
//     along with NetJsWire.  If not, see <http://www.gnu.org/licenses/>.
#endregion

using System.ComponentModel;
using NetJsWire.JsonRpcHandler;
using NetJsWire.Widgets.Ui.Layout;
using NetJsWire.Widgets.Ui.Window;

namespace NetJsWire.Widgets.Config
{
    public class WindowConfigOptions : PanelConfigOptions
    {
        private bool _collapsible = true;

        public WindowConfigOptions( IWidget ownerWidget )
            : base( ownerWidget )
        {

        }

        /// <summary>
        ///   The layout type to be used for this <see cref = "Window" />.
        /// </summary>
        /// <remarks>
        ///   *Important: In order for child items to be correctly sized and positioned, typically a layout manager must be specified through the layout configuration option.
        ///   The sizing and positioning of child items is the responsibility of the Container's layout manager which creates and manages the type of layout you have in mind.
        ///   For example:
        ///   <example>
        ///     <code>
        ///       new Ext.Window({
        ///       width:300, height: 300,
        ///       layout: 'fit', // explicitly set layout manager: override the default (layout:'auto')
        ///       items: [{
        ///       title: 'Panel inside a Window'
        ///       }]
        ///       }).show();
        ///     </code>
        ///   </example>
        ///   If the layout configuration is not explicitly specified for a general purpose container (e.g. Container or Panel) the default layout manager will be used 
        ///   which does nothing but render child components sequentially into the Container (no sizing or positioning will be performed in this situation).
        ///   Some container classes implicitly specify a default layout (e.g. FormPanel specifies layout:'form'). Other specific purpose classes internally 
        ///   specify/manage their internal layout (e.g. GridPanel, TabPanel, TreePanel, Toolbar, Menu, etc.).
        /// </remarks>
        [Description( "The layout type to be used for this Window." )]
        [DefaultValue( LayoutType.Absolute )]
        [Browsable( true )]
        public override LayoutType Layout
        {
            get
            {
                return base.Layout;
            }
            set
            {
                base.Layout = value;
            }
        }

        /// <summary>
        ///   True to make the panel collapsible and have the expand/collapse toggle button automatically rendered into the header tool button area, false to keep the panel statically sized with no button (defaults to true).
        /// </summary>
        [Description( "True to make the panel collapsible and have the expand/collapse toggle button automatically rendered into the header tool button area, false to keep the panel statically sized with no button (defaults to true)." )]
        [DefaultValue( true )]
        [Browsable( true ), EditorBrowsable( EditorBrowsableState.Advanced )]
        public override bool Collapsible
        {
            get { return _collapsible; }
            set
            {
                SetValue( "collapsible", value, false, _collapsible );
                _collapsible = value;
            }
        }

    }
}
